home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / smacros.lha / FWMacros / Save_Address.arexx < prev   
Text File  |  1994-12-17  |  4KB  |  137 lines

  1. /*  Save_Address
  2. A Macro by Steven. R. Giovenella, 5823 Dutchess Dr., Colorado Springs, CO 80918.
  3. © Copyright 1994 Steven. R. Giovenella, All rights reserved. 
  4. This macro is my gift to the Amiga community.  It may be given away free to 
  5. anyone, but it may NOT be sold in any way, shape, or form, not even for the cost of 
  6. reproduction, downloading, shipping, or handling, without express written 
  7. permission from the author listed above.  Any person or company who violates the 
  8. content of the previous sentence, agrees to pay Steven R. Giovenella $1,000 (US) for 
  9. each copy of this macro sold.  This macro may NOT be added to any disk which is to 
  10. be sold for any price or fee, to include shipping and handling.  The ONLY way this 
  11. macro may be distributed is on a disk which is given away 100% free of all charges, 
  12. or on via telecommunications networks which do not charge any additional fee as a 
  13. result of a user downloading this particular macro.  This macro may only be 
  14. reproduced in its entirety, including all comment lines and code.  The individual 
  15. user may alter this macro for personal use, but may not then distribute the macro 
  16. in any modified form.  If you wish, feel free to send me some cash, a Christmas card, 
  17. some other piece of software, or absolutely nothing as a gift for creating this macro.  
  18. The author of this software is not responsible for any data loss or damage to 
  19. computer equipment as a result, direct or indirect, of the use of this macro. */
  20.  
  21. Options Results
  22.  
  23. /* Check to see if no document is open */
  24.     Status FileName
  25.         IF Result = "" THEN flag = 1 
  26.  
  27. /* Initialize*/
  28.     type " "
  29.     backspace
  30.  
  31. /* Open DataFile */
  32.     RequestText '"Save Address" "Enter destination Data File..." 
  33. "Address_DataFile.ASCII"'
  34.         datafile = Result
  35.     file = "FWDocs/" || datafile
  36.     Open file
  37.     altdown
  38.     ctrldown
  39.     cursor down
  40.  
  41. /* Switch ARexx Addresses */
  42.     Status PortName
  43.         port = Result
  44.     portnumber = RIGHT(port,1) + 1
  45.     newport = "FINALW." || portnumber
  46. /*    IF flag=1 THEN newport="FINALW.1" */
  47.     ADDRESS VALUE newport
  48.  
  49. /* Goto to end of file */
  50.     AltDOWN
  51.     CtrlDOWN
  52.     Cursor DOWN
  53.     AltUP
  54.     CtrlUP
  55.  
  56. /* Get ending linenumber */
  57.     Status LinePos
  58.         Coords = Result
  59.         PARSE VAR Coords Line Pos
  60.  
  61. EnterAddress:
  62. /* Input record */
  63.     RequestText '"SAVE Address" "Persons name.  (Line 1 of 8)" ""'
  64.         Address.1 = Result
  65.     RequestText '"SAVE Address" "Company name.  (Line 2 of 8)" ""'
  66.         Address.2 = Result
  67.     RequestText '"SAVE Address" "Street address, line one.  (Line 3 of 8)" ""'
  68.         Address.3 = Result
  69.     RequestText '"SAVE Address" "Street address, line two.  (Line 4 of 8)" ""'
  70.         Address.4 = Result
  71.     RequestText '"SAVE Address" "City name.  (Line 5 of 8)" ""'
  72.         Address.5 = Result
  73.     RequestText '"SAVE Address" "State.  (Line 6 of 8)" ""'
  74.         Address.6 = Result
  75.     RequestText '"SAVE Address" "Zip Code.  (Line 7 of 8)" ""'
  76.         Address.7 = Result
  77.     RequestText '"SAVE Address" "Phone Number.  (Line 8 of 8)" ""'
  78.         Address.8 = Result
  79.  
  80. /* Format record (remove commas) */
  81.     DO j=1 to 8
  82.         DO i=1 to LENGTH(address.j)
  83.             IF RIGHT(LEFT(address.j , i) , 1) = "," THEN DO
  84.                 fronthalf = LEFT(address.j , (i-1))
  85.                 backhalf = RIGHT(address.j ,  LENGTH(address.j) - i)
  86.                 address.j = fronthalf || " " || backhalf
  87.                 END
  88.             END
  89.         END
  90.  
  91. /* Confirmation */
  92.     ShowMessage 1 0 '"Confirm that you wish to save this address." "" "" "Save" " 
  93. Re-Input Address " " Cancel "'
  94.         IF Result=2 THEN Call EnterAddress
  95.         IF Result=3 THEN DO
  96.             Close Force
  97.             Exit
  98.             END            
  99.  
  100. /* Insert Record */
  101.     DO i=1 to 8
  102.         type address.i
  103.         type ","
  104.         END
  105.     Backspace
  106.     newparagraph
  107.         
  108. /* Select from line 2 position 0 to end-1 */
  109.     MoveToLine 2 0
  110.     ShiftDOWN
  111.     CtrlDOWN
  112.     AltDOWN
  113.     Cursor DOWN
  114.     AltUP
  115.     CtrlUP
  116.     Cursor UP
  117.  
  118. /* Sort */
  119.     Sort LowToHigh
  120.  
  121. /* Deselect */
  122.     Cursor DOWN
  123.     AltUP
  124.     CtrlUP
  125.     ShiftUP
  126.     MoveToLine 2 0
  127.  
  128. /* Set ASCII Preferences */
  129.     ASCIIPrefs paranewline NO parablankline YES insertnewline NO insert 
  130. blankline YES
  131.  
  132. /* Save ASCII */
  133.     Save ASCII "FWDocs/Address_DataFile.ASCII"
  134.  
  135. /* Close DataFile */
  136.     Close FORCE 
  137.